/*
 * McServer.h
 *
 *  Created on: 2017年6月15日
 *      Author: orange
 */

#ifndef MCSERVER_H_
#define MCSERVER_H_

#include <map>
#include <string>

#include "public/JuzBase.h"
#include "public/PublicDefine.h"
#include "public/rwLock.h"

using namespace std;

class McServer :public JuzBase{
public:
	McServer(string user,string pass);
	virtual ~McServer();

	bool getOnline();//获取此服务器是否有效


public:
	string mUser;
	string mPass;

    rwLock mAndroidClientLock;
    map<int,JUZ_ANDROID_CLIENT*> mAndroidClient; //安卓客户端
private:
    //服务器私有属性  访问必须枷锁
    rwLock mServerlock;
    int mRootFD = -1;//表明MC服务器是否上线

    int mNumPeople = 0;//服务器人数
public:
    //成员 set 与 get
	int getRootFd() {
		mServerlock.readLock();
		int nResult = mRootFD;
		mServerlock.unLock();
		return nResult;
	}

	void setRootFd(int rootFd = -1) {
		mServerlock.writeLock();
		mRootFD = rootFd;
		mServerlock.unLock();
	}
	void setmNumPeople(int num)
	{
		mServerlock.writeLock();
		mNumPeople = num;
		mServerlock.unLock();
	}

	int getmNumPeople()
	{
		return mNumPeople;
	}
};

#endif /* MCSERVER_H_ */
